﻿<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
    <title>综合治税GISAPP-登录</title>
    <link rel="stylesheet" href="Content/src/css/layui.css" media="all">
    <link rel="stylesheet" href="Content/css/global.css"> 
</head>
<body>
<style type="text/css">html{background: #fff;}</style>
<div class="login_page">
    <img class="logo-login" src="Content/images/logo-login.png" alt="logo">
    <h1 style="margin-top:50px;margin-bottom:50px">欢迎使用 - 智税后台管理系统</h1>
    <div class="layui-form">
        <div class="layui-form-item" >
            <div class="layui-input-inline input-custom-width">
                <input type="text" id="username" name="username" lay-verify="required" placeholder="用户名" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item" style="margin-top:30px">
            <div class="layui-input-inline input-custom-width">
                <input type="password" id="password" name="password" lay-verify="required" placeholder="密码" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item" style="margin-top:30px">
            <div class="layui-input-inline input-custom-width">
                <button class="layui-btn input-custom-width" id="login">立即登陆</button>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript" src="Content/src/layui.js"></script>
<script type="text/javascript">
    layui.use(['element', 'layer', 'form', 'layedit'], function () {
        var element = layui.element()
        , jq = layui.jquery
        , form = layui.form()
        , layedit = layui.layedit
        , laypage = layui.laypage;

        //监听提交
        jq('#login').on('click', function (data) {
            var us = {
                User_UserName: jq('#username').val(),
                User_Password: jq('#password').val()
            };
            loading = layer.load();
            jq.ajax({
                type: 'POST',
                url: '/api/Users/UsByNameAndPass',
                contentType: "application/json",
                dataType: "json",
                data: JSON.stringify(us),
                success: function (data) {
                    layer.close(loading);
                    if (data.AnswerType == 1) {
                        localStorage.setItem("username", data.User.User_RealName);//用户姓名
                        localStorage.setItem("userid", data.User.User_Id);//用户Id
                        localStorage.setItem("dtparentId", data.User.User_DtParentId);//用户所属街办Id
                        window.location.href = "index.html";
                    } else {
                        layer.msg(data.AnswerMeg);
                    }
                }
            });
        });
});
</script>
</body>
</html>